#include <iostream>
using namespace std;
#include<cmath>
typedef long long LL;
int t;
bool func(LL x)
{
    if (x < 2) return false;
    for (int i = 2; i <= sqrt(x); i++)
    {
        if (x % i == 0)
            return false;
    }
    return true;
}
int main()
{
    cin >> t;
    while (t--)
    {
        LL a, b;
        cin >> a >> b;
        if ((a == 1 && func(b)) || (b == 1 && func(a)))
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
    return 0;
}

#include <iostream>
#include<algorithm>
using namespace std;
int n, k;
const int N = 2e5 + 10;
int arr[N];
int main()
{
    cin >> n >> k;
    for (int i = 0; i < n; i++) cin >> arr[i];
    sort(arr, arr + n);
    int left = 0, right = 0, ret = 1;
    while (right < n)
    {
        while (arr[right] - arr[left] > k) left++;
        ret = max(ret, right - left + 1);
        right++;
    }
    cout << ret << endl;
    return 0;
}

#include <iostream>
using namespace std;
string s1, s2;
const int N = 1010;
int dp[N][N];
int n, m;
int main()
{
    cin >> n >> m;
    cin >> s1 >> s2;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {
            if (s1[i - 1] == s2[j - 1]) dp[i][j] = dp[i - 1][j - 1] + 1;
            else dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
        }
    }
    cout << dp[n][m] << endl;
    return 0;
}